package chapter

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

var map_data map[string]interface{} = map[string]interface{}{
	"zs": gin.H{"age": 15, "addr": "zs-xx"},
	"ls": gin.H{"age": 43, "addr": "ls-xx"},
	"ww": gin.H{"age": 33, "addr": "ww-xx"},
}

func AuthTest(ctx *gin.Context) {
	user_name := ctx.Query("user_name")
	data, ok := map_data[user_name]
	if ok {
		ctx.JSON(http.StatusOK, gin.H{"data": data, "user": user_name})
	} else {
		ctx.JSON(http.StatusNotFound, gin.H{"user": user_name, "data": data})
	}
}

func WrapFTest(w http.ResponseWriter, r *http.Request) {

}
